//
//  SwiftView.swift
//  SwiftTool
//
//  Created by 红沙尘 on 2018/11/27.
//  Copyright © 2018年 红沙尘. All rights reserved.
//

import Foundation
import UIKit

extension UIButton {
    
    //环形进度
    func process() {
        
        let w:CGFloat = 86.0
        var fff = CGRect(x: 0, y: 0, width: w, height: w)
        fff.origin.x = (110.0 - w)/2.0 + 3
        fff.origin.y = (110.0 - w)/2.0 + 0
        
        let progressLayer = CAShapeLayer()
        let path = UIBezierPath.init(ovalIn: fff).cgPath
        progressLayer.frame = bounds
        progressLayer.fillColor = UIColor.clear.cgColor
        progressLayer.strokeColor = UIColor.red.cgColor
        progressLayer.lineWidth = 3
        progressLayer.path = path
        progressLayer.strokeStart = 0.0
        progressLayer.strokeEnd = 0.1
        progressLayer.transform = CATransform3DMakeRotation(-CGFloat.pi/2.0, 0, 0, 1)
        layer.addSublayer(progressLayer)        
    }
}
